package com.ls.common;

import com.alibaba.fastjson.JSON;
import com.ls.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.http.HttpSession;

import static com.ls.common.Const.KEY_SESSION;


/**
 * <p></p>
 * Created by zhezhiyong@163.com on 2017/2/10.
 */
public abstract class BaseController {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    public User getUser(HttpSession httpSession){
        User user = (User) httpSession.getAttribute(KEY_SESSION);
        logger.info("login user: {}", JSON.toJSONString(user));
        return user;
    }

}
